package com.ezandroid.library.network.http.request;

import java.io.IOException;

import okhttp3.OkHttpClient;
import okhttp3.Response;

/**
 * An HTTP stack abstraction based on {@link OkHttpClient}.
 *
 * @author markmjw
 * @date 2015-05-29
 */
public interface HttpStack {
    /**
     * Performs an HTTP request with the given parameters.
     * <p>
     * <p>A GET request is sent if request.getPostBody() == null. A POST request is sent otherwise,
     * and the Content-Type header is set to request.getPostBodyContentType().</p>
     *
     * @param request the request to perform
     * @return the HTTP response {@link Response}.
     */
    Response performRequest(Request<?> request) throws IOException;
}
